﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;
using Teigha.Core;

namespace Teigha.TD
{
	public class OdDbShHistory : OdDbObject
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdDbShHistory(IntPtr cPtr, bool cMemoryOwn) : base(TD_DbPINVOKE.OdDbShHistory_SWIGUpcast(cPtr), cMemoryOwn)
		{
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdDbShHistory obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdDbShHistory()
		{
			this.Dispose();
		}

		public override void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							TD_DbPINVOKE.delete_OdDbShHistory(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
			base.Dispose();
		}

		public new static OdDbShHistory cast(OdRxObject pObj)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = TD_DbPINVOKE.OdDbShHistory_cast(OdRxObject.getCPtr(pObj));
			OdDbShHistory result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdDbShHistory)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdDbShHistory)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdDbShHistory)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdRxClass desc()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(TD_DbPINVOKE.OdDbShHistory_desc(), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxClass isA()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(TD_DbPINVOKE.OdDbShHistory_isA(this.swigCPtr), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxObject queryX(OdRxClass protocolClass)
		{
			OdRxObject result = Teigha.Core.Helpers.odrxCreateObjectInternal(TD_DbPINVOKE.OdDbShHistory_queryX(this.swigCPtr, OdRxClass.getCPtr(protocolClass)), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdDbShHistory createObject()
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = TD_DbPINVOKE.OdDbShHistory_createObject();
			OdDbShHistory result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdDbShHistory)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdDbShHistory)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdDbShHistory)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdDbShHistory() : this(TD_DbPINVOKE.new_OdDbShHistory__SWIG_1(), true)
		{
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public new virtual OdResult dwgInFields(OdDbDwgFiler pFiler)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbShHistory_dwgInFields(this.swigCPtr, OdDbDwgFiler.getCPtr(pFiler));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual void dwgOutFields(OdDbDwgFiler pFiler)
		{
			TD_DbPINVOKE.OdDbShHistory_dwgOutFields(this.swigCPtr, OdDbDwgFiler.getCPtr(pFiler));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public new virtual OdResult dxfInFields(OdDbDxfFiler pFiler)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbShHistory_dxfInFields(this.swigCPtr, OdDbDxfFiler.getCPtr(pFiler));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual void dxfOutFields(OdDbDxfFiler pFiler)
		{
			TD_DbPINVOKE.OdDbShHistory_dxfOutFields(this.swigCPtr, OdDbDxfFiler.getCPtr(pFiler));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual OdResult setShowHistory(bool bShowhistory)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbShHistory_setShowHistory(this.swigCPtr, bShowhistory);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual bool showHistory()
		{
			bool result = TD_DbPINVOKE.OdDbShHistory_showHistory(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual int numNodes()
		{
			int result = TD_DbPINVOKE.OdDbShHistory_numNodes(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdResult setRecordHistory(bool bRecordHistory)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbShHistory_setRecordHistory(this.swigCPtr, bRecordHistory);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual bool recordHistory()
		{
			bool result = TD_DbPINVOKE.OdDbShHistory_recordHistory(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void clearHistory()
		{
			TD_DbPINVOKE.OdDbShHistory_clearHistory(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual OdResult purgeGraph()
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbShHistory_purgeGraph(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdResult getGraph(OdDbObjectId arg0)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbShHistory_getGraph(this.swigCPtr, OdDbObjectId.getCPtr(arg0));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdResult createBox(double dXLen, double dYLen, double dZLen)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbShHistory_createBox(this.swigCPtr, dXLen, dYLen, dZLen);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdResult createFrustum(double dHeight, double dXRadius, double dYRadius, double dTopXRadius)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbShHistory_createFrustum(this.swigCPtr, dHeight, dXRadius, dYRadius, dTopXRadius);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdResult createSphere(double dRadius)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbShHistory_createSphere(this.swigCPtr, dRadius);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdResult createTorus(double dMajorRadius, double dMinorRadius)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbShHistory_createTorus(this.swigCPtr, dMajorRadius, dMinorRadius);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdResult createWedge(double dXLen, double dYLen, double dZLen)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbShHistory_createWedge(this.swigCPtr, dXLen, dYLen, dZLen);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdResult createPyramid(double dHeight, int iSides, double dRadius, double dTopRadius)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbShHistory_createPyramid(this.swigCPtr, dHeight, iSides, dRadius, dTopRadius);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdResult setSubentColor(OdDbSubentId subentId, OdCmColor color)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbShHistory_setSubentColor(this.swigCPtr, OdDbSubentId.getCPtr(subentId), OdCmColor.getCPtr(color));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdResult setSubentMaterial(OdDbSubentId subentId, OdDbObjectId matId)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbShHistory_setSubentMaterial(this.swigCPtr, OdDbSubentId.getCPtr(subentId), OdDbObjectId.getCPtr(matId));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdResult createLoftedSolid(OdDbEntityPtrArray crossSections, OdDbEntityPtrArray guideCurves, OdDbEntity pPathCurve, OdDbLoftOptions loftOpt)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbShHistory_createLoftedSolid(this.swigCPtr, OdDbEntityPtrArray.getCPtr(crossSections), OdDbEntityPtrArray.getCPtr(guideCurves), OdDbEntity.getCPtr(pPathCurve), OdDbLoftOptions.getCPtr(loftOpt));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdResult createRevolvedSolid(OdDbEntity pRevolveCurve, OdGePoint3d axisPoint, OdGeVector3d axisDir, double dAngleOfRevolution, double dStartAngle, OdDbRevolveOptions revolveOpt)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbShHistory_createRevolvedSolid(this.swigCPtr, OdDbEntity.getCPtr(pRevolveCurve), OdGePoint3d.getCPtr(axisPoint), OdGeVector3d.getCPtr(axisDir), dAngleOfRevolution, dStartAngle, OdDbRevolveOptions.getCPtr(revolveOpt));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdResult createSweptSolid(OdDbEntity pSweepCurve, OdDbEntity pPathCurve, OdGeVector3d directioVector, OdDbSweepOptions sweepOpt)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbShHistory_createSweptSolid(this.swigCPtr, OdDbEntity.getCPtr(pSweepCurve), OdDbEntity.getCPtr(pPathCurve), OdGeVector3d.getCPtr(directioVector), OdDbSweepOptions.getCPtr(sweepOpt));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdResult booleanOper(OdDbShHistory pSecondEll, BoolOperType operation)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbShHistory_booleanOper(this.swigCPtr, OdDbShHistory.getCPtr(pSecondEll), (int)operation);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdResult postInDatabase(OdDbObjectId objId, OdDbDatabase pDatabase)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbShHistory_postInDatabase(this.swigCPtr, OdDbObjectId.getCPtr(objId), OdDbDatabase.getCPtr(pDatabase));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdResult subTransformBy(OdGeMatrix3d xform)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbShHistory_subTransformBy(this.swigCPtr, OdGeMatrix3d.getCPtr(xform));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		private object locker = new object();

		private HandleRef swigCPtr;
	}
}
